package uabc.arduino.pruebas;

import uabc.arduino.monitores.MonitorTCP;

public class PruebaConcepto {
	static Thread tMonitor;
	public static void main(String[] args) {
		final MonitorTCP monitor = new MonitorTCP(8888, "192.168.2.112", 8889);
		tMonitor = new Thread() {
			public void run() {
				monitor.run();
			}
		};
		startThread();
		System.out.println("Ejecutando comandos");
		while (true) {
			monitor.ejecutarComando("2:1:1");
			delay(1000);
			monitor.ejecutarComando("2:2:1");
			delay(1000);
			monitor.ejecutarComando("2:3:1");
			delay(1000);
			monitor.ejecutarComando("2:1:0");
			delay(1000);
			monitor.ejecutarComando("2:2:0");
			delay(1000);
			monitor.ejecutarComando("2:3:0");
			delay(1000);
		}
	}

	public static void delay(long miliseconds) {
		try {
			Thread.sleep(miliseconds);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public static void startThread() {
		tMonitor.start();
	}
}
